package com.example.springdemo.others.a;

/**
 * 通过接口来达到两个类之间的通信
 */
public class A {

    private interfaceA interfaceA;
    public A(interfaceA interfaceA) {
        this.interfaceA = interfaceA;
    }
    public void doSome(boolean t){
     if (t){
         interfaceA.methodA();
     }else {
         interfaceA.methodB();
     }


    }

    interface interfaceA{
        void methodA();
        void methodB();
    }
}
